Chapter 9 Functional differences

9.1 Gut microbiota

load("data/gut/data.Rdata")

sample_metadata <- sample_metadata %>% 
  filter(sample!="EHI02625")
sample_metadata$environment <- factor(sample_metadata$environment, levels=c("low", "high"))
treatment_colors <- c("#f56042","#429ef5")
genome_counts_filt <- genome_counts_filt %>%
  select(-EHI02625)
genome_counts_filt <- genome_counts_filt[genome_counts_filt$genome %in% rownames(genome_gifts),] 
rownames(genome_counts_filt) <- NULL
#Aggregate bundle-level GIFTs into the compound level
GIFTs_elements <- to.elements(genome_gifts[, !grepl("^S", colnames(genome_gifts))],GIFT_db) # Remove structure traits
GIFTs_elements_filtered <- GIFTs_elements[rownames(GIFTs_elements) %in% genome_counts_filt$genome,]
GIFTs_elements_filtered <- as.data.frame(GIFTs_elements_filtered) %>% 
  select_if(~ !is.numeric(.) || sum(.) != 0)

#Aggregate element-level GIFTs into the function level
GIFTs_functions <- to.functions(GIFTs_elements_filtered,GIFT_db)

#Aggregate function-level GIFTs into overall Biosynthesis, Degradation and Structural GIFTs
GIFTs_domains <- to.domains(GIFTs_functions,GIFT_db)

#Get community-weighed average GIFTs per sample
genome_counts_row <- genome_counts_filt %>%
  mutate_at(vars(-genome),~./sum(.)) %>% 
  column_to_rownames(., "genome")

#genome_counts_row <- rownames_to_column(genome_counts_row, "genome")
GIFTs_elements_community <- to.community(GIFTs_elements_filtered,genome_counts_row,GIFT_db)
GIFTs_functions_community <- to.community(GIFTs_functions,genome_counts_row,GIFT_db)
GIFTs_domains_community <- to.community(GIFTs_domains,genome_counts_row,GIFT_db)

9.1.1 Metabolic capacity index (MCI)

GIFTs_functions_community %>%
  rowMeans() %>%
  as_tibble(., rownames = "sample") %>%
  left_join(sample_metadata, by = "sample") %>%
  group_by(environment) %>%
  summarise(MCI = mean(value), sd = sd(value)) %>%
  tt()
environment MCI sd
low 0.2687300 0.01151867
high 0.2657253 0.01442070
MCI <- GIFTs_functions_community %>%
  rowMeans() %>%
  as_tibble(., rownames = "sample") %>%
  left_join(sample_metadata, by = "sample")

shapiro.test(MCI$value) %>% 
  tidy()
# A tibble: 1 × 3
  statistic p.value method                     
      <dbl>   <dbl> <chr>                      
1     0.977   0.741 Shapiro-Wilk normality test
wilcox.test(value ~ environment, data=MCI) %>% 
  tidy()
# A tibble: 1 × 4
  statistic p.value method                       alternative
      <dbl>   <dbl> <chr>                        <chr>      
1       136   0.345 Wilcoxon rank sum exact test two.sided  
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 999

adonis2(formula = GIFTs_functions_community_dist ~ environment, data = sample_metadata %>% arrange(match(sample, labels(GIFTs_functions_community_dist))), permutations = 999, by = "terms")
            Df SumOfSqs      R2      F Pr(>F)  
environment  1  0.03090 0.09024 2.7775  0.022 *
Residual    28  0.31146 0.90976                
Total       29  0.34236 1.00000                
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

MCI %>% 
  ggplot(aes(x=environment, y=value, color = environment, fill=environment)) +
    geom_boxplot(alpha = 0.2, outlier.shape = NA, width = 0.3, show.legend = FALSE) +
    geom_jitter(width = 0.1, show.legend = TRUE) +
    scale_color_manual(values=treatment_colors)+
    scale_fill_manual(values=treatment_colors)+
  theme_minimal() +
  theme(
    axis.line = element_line(size = 0.5, linetype = "solid", colour = "black"),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.border = element_blank())

GIFTs_elements_community %>%
    as.data.frame() %>%
    rownames_to_column(var="sample")%>%
    pivot_longer(!sample,names_to="trait",values_to="gift") %>%
    left_join(sample_metadata, by = join_by(sample == sample)) %>%
    mutate(functionid = substr(trait, 1, 3)) %>%
    mutate(trait = case_when(
      trait %in% GIFT_db$Code_element ~ GIFT_db$Element[match(trait, GIFT_db$Code_element)],
      TRUE ~ trait
    )) %>%
    mutate(functionid = case_when(
      functionid %in% GIFT_db$Code_function ~ GIFT_db$Function[match(functionid, GIFT_db$Code_function)],
      TRUE ~ functionid
    )) %>%
    mutate(trait=factor(trait,levels=unique(GIFT_db$Element))) %>%
    mutate(functionid=factor(functionid,levels=unique(GIFT_db$Function))) %>%
    ggplot(aes(x=sample,y=trait,fill=gift)) +
        geom_tile(colour="white", linewidth=0.2)+
        scale_fill_gradientn(colours=rev(c("#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#e6f598", "#abdda4", "#ddf1da")))+
        facet_grid(functionid ~ environment, scales="free",space="free") +
        theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
              axis.text.y = element_text(size=8),
              strip.text.y = element_text(angle = 0)
              ) +
        labs(y="Traits",x="Samples",fill="GIFT")

9.1.2 Wilcoxon

9.1.2.1 Community elements differences

element_gift <- GIFTs_elements_community %>% 
  as.data.frame() %>% 
  rownames_to_column(., "sample") %>% 
  left_join(sample_metadata %>% select(sample,environment,river), by=join_by("sample"=="sample"))
uniqueGIFT_db<- unique(GIFT_db[c(2,4,5,6)]) %>% unite("Function",Function:Element, sep= "_", remove=FALSE)

significant_elements <- element_gift %>%
    pivot_longer(-c(sample,environment,river), names_to = "trait", values_to = "value") %>%
    group_by(trait) %>%
    summarise(p_value = wilcox.test(value ~ environment)$p.value) %>%
    mutate(p_adjust=p.adjust(p_value, method="BH")) %>%
    filter(p_adjust < 0.05)%>%
  rownames_to_column(., "Elements")  %>%
  left_join(.,uniqueGIFT_db[c(1,3)],by = join_by(trait == Code_element))

element_gift_t <- element_gift  %>% 
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "trait")

element_gift_filt <- subset(element_gift_t, trait %in% significant_elements$trait) %>% 
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "sample")%>% 
  left_join(sample_metadata %>% select(sample,environment,river), by = join_by(sample == sample))

element_gift_filt %>%
  select(-c(sample,river))%>%
  group_by(environment) %>%
  summarise(across(everything(), mean))%>%
   t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "Elements")  %>%
  left_join(.,uniqueGIFT_db[c(1,3)],by = join_by(Elements == Code_element))
   Elements          low         high                                      Function
1     B0210 0.5209436000 0.4509265000               Amino acid biosynthesis_Leucine
2     B0215 0.4987544000 0.5656788000             Amino acid biosynthesis_Histidine
3     B0218 0.3182126000 0.2983654000              Amino acid biosynthesis_Tyrosine
4     B0219 0.0231044000 0.0186570700                  Amino acid biosynthesis_GABA
5     B0220 0.0655121800 0.0480075800          Amino acid biosynthesis_Beta-alanine
6     B0307 0.3575178000 0.3030128000 Amino acid derivative biosynthesis_Spermidine
7     B0706 0.4328692000 0.5003124000              Vitamin biosynthesis_Biotin (B7)
8     B0710 0.0526786800 0.0786377400       Vitamin biosynthesis_Phylloquinone (K1)
9     B0711 0.2579474000 0.3005016000         Vitamin biosynthesis_Menaquinone (K2)
10    B1012 0.0149240150 0.0065831860            Antibiotic biosynthesis_Fosfomycin
11    D0101 0.0928441900 0.0506893400                Lipid degradation_Triglyceride
12    D0104 0.1351958300 0.0936400900          Lipid degradation_Dicarboxylic acids
13    D0504 0.0211782000 0.0540603300             Amino acid degradation_Methionine
14    D0516 0.0780710300 0.0469275900           Amino acid degradation_Beta-alanine
15    D0606 0.0426329300 0.0253378300       Nitrogen compound degradation_Allantoin
16    D0610 0.0046945340 0.0091389410     Nitrogen compound degradation_Methylamine
17    D0704 0.3817523000 0.3135096000                  Alcohol degradation_Glycerol
18    D0709 0.0007728956 0.0000000000         Alcohol degradation_Polyvinyl alcohol
19    D0805 0.0029745460 0.0052878350               Xenobiotic degradation_Benzoate
20    D0812 0.0003603398 0.0007750193            Xenobiotic degradation_Naphthalene
21    D0816 0.1123401900 0.0953450600          Xenobiotic degradation_Phenylacetate
22    D0907 0.2604483000 0.2005187000           Antibiotic degradation_Tetracycline
23    D0910 0.3969376000 0.3309116000        Antibiotic degradation_Chloramphenicol
difference_table <- element_gift_filt %>%
  select(-sample) %>%
  group_by(environment) %>%
  summarise(across(everything(), mean)) %>%
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric) %>%
  rownames_to_column(., "Elements") %>%
  left_join(.,uniqueGIFT_db[c(1,3,4)],by = join_by(Elements == Code_element)) %>% 
  arrange(Function) %>% 
  mutate(Difference=high-low)%>% 
  mutate(group_color = ifelse(Difference <0, "Low","High")) 
means_gift <- element_gift_filt %>% 
  select(-c(environment,river)) %>% 
  pivot_longer(!sample, names_to = "elements", values_to = "abundance") %>% 
  left_join(sample_metadata, by=join_by(sample==sample)) %>% 
  group_by(environment, elements) %>%
  summarise(mean=mean(abundance))

log_fold <- means_gift %>%
  group_by(elements) %>%
  summarise(
    logfc_high_low = log2(mean[environment == "high"] / mean[environment == "low"])
    )
element_gift_names <- element_gift_filt %>%
  select(-c(environment,river)) %>%
   t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "Elements")  %>%
  left_join(.,uniqueGIFT_db[c(1,3)],by = join_by(Elements == Code_element))%>%
  select(-Elements)%>%
  select(Function, everything())%>%
   t()%>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "sample")%>% 
  left_join(sample_metadata %>% select(sample,environment,river), by = join_by(sample == sample))


colNames <- names(element_gift_names %>% select(-c(sample,environment,river)))
for(i in colNames){
  plt <- ggplot(element_gift_names, aes(x=environment, y=.data[[i]], color = environment, fill=environment)) +
    geom_boxplot(alpha = 0.2, outlier.shape = NA, width = 0.3, show.legend = FALSE) +
    geom_jitter(width = 0.1, show.legend = TRUE) +
  scale_color_manual(values=treatment_colors)+
  scale_fill_manual(values=treatment_colors) +
  theme_minimal() +
  theme(
    axis.line = element_line(size = 0.5, linetype = "solid", colour = "black"),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.border = element_blank())
print(plt)
}

difference_table %>%
  ggplot(aes(x=forcats::fct_reorder(Function,Difference), y=Difference, fill=group_color)) + 
  geom_col() +
#  geom_point(size=4) + 
  scale_fill_manual(values=treatment_colors) +
  geom_hline(yintercept=0) + 
  coord_flip()+
  theme(axis.text = element_text(size = 10),
        axis.title = element_text(size = 12),
        legend.position = "right", 
        panel.background = element_blank(),
          panel.grid.major = element_line(size = 0.15, linetype = 'solid',
                                colour = "grey"))+
  xlab("Microbial Functional Capacity") + 
  ylab("Mean difference")+
  labs(fill="Elevation")
uniqueGIFT <- unique(GIFT_db[c(2,3,4,5,6)])

code_function <- difference_table %>%
  left_join(uniqueGIFT[c(1:3)], by=join_by(Elements==Code_element))

unique_codes<-unique(code_function$Code_function)

gift_colors <- read_tsv("data/gift_colors.tsv") %>% 
  filter(Code_function %in% unique_codes)%>% 
  mutate(legend=str_c(Code_function," - ",Function))

code_function %>%
#  mutate(Difference_abs = abs(Difference)) %>% 
  left_join(significant_elements, by=join_by(Elements==trait)) %>%
  left_join(log_fold, by=join_by(Elements==elements)) %>% 
  left_join(gift_colors, by=join_by(Code_function==Code_function)) %>% 
  ggplot(., aes(x = logfc_high_low, y = -log(p_adjust), color=legend, size=abs(Difference))) +
  geom_jitter(width = 0.2, height = 0.2)+
  geom_vline(xintercept=0) +
  scale_color_manual(values = gift_colors$Color)+
  #xlim(c(-10,4)) +
  theme_classic()+
  labs(size="Mean difference (abs)", color="Functional trait")+
  labs(x = "Log-fold change", y="-Log adjusted p-value") +
  geom_text_repel(aes(label = Element), min.segment.length = 0.4, size=2.5, max.overlaps = Inf)

9.1.2.2 Community functions differences

function_gift <- GIFTs_functions_community %>% 
  as.data.frame() %>% 
  rownames_to_column(., "sample") %>% 
  merge(., sample_metadata %>% select(sample,environment,river), by="sample")
unique_funct_db<- GIFT_db[c(3,4,5)] %>% 
  distinct(Code_function, .keep_all = TRUE)

significant_functional <- function_gift %>%
    pivot_longer(-c(sample,environment,river), names_to = "trait", values_to = "value") %>%
    group_by(trait) %>%
    summarise(p_value = wilcox.test(value ~ environment)$p.value) %>%
    mutate(p_adjust=p.adjust(p_value, method="BH")) %>%
    filter(p_adjust < 0.05)%>%
  left_join(.,unique_funct_db[c(1,3)],by = join_by(trait == Code_function))
function_gift_t <- function_gift  %>% 
  select(-environment)  %>% 
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "trait")

function_gift_filt <- subset(function_gift_t, trait %in% significant_functional$trait) %>% 
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "sample")%>% 
  left_join(., sample_metadata %>% select(sample,environment,river), by = join_by(sample == sample))


function_gift_filt %>%
  select(-c(sample,river)) %>%
  group_by(environment)  %>%
  summarise(across(everything(), mean))%>%
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "Code_function")  %>%
  left_join(unique_funct_db[c(1,3)],by = join_by(Code_function == Code_function))
  Code_function        low       high            Function
1           D01 0.09715327 0.06631964   Lipid degradation
2           D07 0.23552990 0.19997740 Alcohol degradation
function_gift_names <- function_gift_filt%>%
  select(-c(environment,river)) %>%
   t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "Code_function")  %>%
  left_join(.,unique_funct_db[c(1,3)],by = join_by(Code_function == Code_function))%>%
  select(-Code_function)%>%
  select(Function, everything())%>%
   t()%>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "sample")%>% 
  left_join(sample_metadata %>% select(sample,environment,river), by = join_by(sample == sample))


colNames <- names(function_gift_names)[2]
for(i in colNames){
  plt <- ggplot(function_gift_names, aes(x=environment, y=.data[[i]], color = environment, fill=environment)) +
    geom_boxplot(alpha = 0.2, outlier.shape = NA, width = 0.3, show.legend = FALSE) +
  geom_jitter(width = 0.1, show.legend = TRUE) +
    scale_color_manual(values=treatment_colors)+
    scale_fill_manual(values=treatment_colors)+
  theme_minimal() +
  theme(
    axis.line = element_line(size = 0.5, linetype = "solid", colour = "black"),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.border = element_blank())
print(plt)
}

9.1.2.3 Community domains differences

domain_gift <- GIFTs_domains_community %>% 
  as.data.frame() %>% 
  rownames_to_column(., "sample") %>% 
  merge(sample_metadata %>% select(sample,environment,river), by="sample")
unique_domain_db<- GIFT_db[c(4)] %>% 
  distinct(Domain, .keep_all = TRUE)

significant_domain <- domain_gift %>%
    pivot_longer(-c(sample,environment,river), names_to = "trait", values_to = "value") %>%
    group_by(trait) %>%
    summarise(p_value = wilcox.test(value ~ environment)$p.value) %>%
    mutate(p_adjust=p.adjust(p_value, method="BH")) %>%
    filter(p_adjust < 0.05)
domain_gift_t <- domain_gift  %>% 
  select(-environment)  %>% 
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "trait")

domain_gift_filt <- subset(domain_gift_t, trait %in% significant_domain$trait) %>% 
  t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "sample") %>% 
  left_join(sample_metadata %>% select(sample,environment,river), by = "sample")


domain_gift_filt %>%
  select(-c(sample,river)) %>%
  group_by(environment)  %>%
  summarise(across(everything(), mean))%>%
   t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "Code_domain")
  Code_domain       low      high
1 Degradation 0.1839132 0.1748753
domain_gift_names <- domain_gift_filt%>%
  select(-environment)%>%
   t() %>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "Code_domain")  %>%
  # select(-Code_domain)%>%
  # select(domain, everything())%>%
   t()%>%
  row_to_names(row_number = 1) %>%
  as.data.frame() %>%
  mutate_if(is.character, as.numeric)  %>%
  rownames_to_column(., "sample")%>% 
  left_join(sample_metadata %>% select(sample,environment,river), by = join_by(sample == sample))


colNames <- names(domain_gift_names)[2:3]
for(i in colNames){
  plt <- ggplot(domain_gift_names, aes(x=environment, y=.data[[i]], color = environment, fill=environment)) +
    geom_boxplot(alpha = 0.2, outlier.shape = NA, width = 0.3, show.legend = FALSE) +
  geom_jitter(width = 0.1, show.legend = TRUE) +
    scale_color_manual(values=treatment_colors)+
    scale_fill_manual(values=treatment_colors)+
  theme_minimal() +
  theme(
    axis.line = element_line(size = 0.5, linetype = "solid", colour = "black"),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    panel.border = element_blank())
print(plt)
}

9.2 Skin microbiota

9.2.1 MCI

GIFTs_functions_community %>%
  rowMeans() %>%
  as_tibble(., rownames = "sample") %>%
  left_join(sample_metadata, by = join_by(sample == sample)) %>%
#  filter(time_point=="0_Wild") %>%
  group_by(environment) %>%
  summarise(MCI = mean(value), sd = sd(value))
# A tibble: 2 × 3
  environment   MCI     sd
  <fct>       <dbl>  <dbl>
1 low         0.358 0.0521
2 high        0.295 0.0599
MCI <- GIFTs_functions_community %>%
  rowMeans() %>%
  as_tibble(., rownames = "sample") %>%
  left_join(sample_metadata, by = join_by(sample == sample)) 
# %>% 
#   filter(diet!="Post_grass")

shapiro.test(MCI$value)

    Shapiro-Wilk normality test

data:  MCI$value
W = 0.92978, p-value = 0.04846
wilcox.test(value ~ environment, data=MCI)

    Wilcoxon rank sum exact test

data:  value by environment
W = 181, p-value = 0.001367
alternative hypothesis: true location shift is not equal to 0
Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 999

adonis2(formula = GIFTs_functions_community_dist ~ environment, data = sample_metadata %>% filter(sample %in% labels(GIFTs_functions_community_dist)) %>% arrange(match(sample, labels(GIFTs_functions_community_dist))), permutations = 999, by = "terms")
            Df SumOfSqs      R2      F Pr(>F)   
environment  1   0.7443 0.19325 6.7072  0.003 **
Residual    28   3.1071 0.80675                 
Total       29   3.8514 1.00000                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

9.2.2 Wilcoxon

9.2.2.1 Community elements differences

   Elements         low        high                                      Function
1     B0205 0.656049000 0.475561400             Amino acid biosynthesis_Threonine
2     B0207 0.558104900 0.437034800            Amino acid biosynthesis_Methionine
3     B0208 0.720234000 0.453394600                Amino acid biosynthesis_Valine
4     B0209 0.817868200 0.533705800            Amino acid biosynthesis_Isoleucine
5     B0210 0.743591700 0.450369200               Amino acid biosynthesis_Leucine
6     B0211 0.692446900 0.527403300                Amino acid biosynthesis_Lysine
7     B0212 0.662103100 0.482202700              Amino acid biosynthesis_Arginine
8     B0213 0.658973300 0.404776500               Amino acid biosynthesis_Proline
9     B0214 0.538837000 0.427169000             Amino acid biosynthesis_Glutamate
10    B0215 0.555625900 0.384205800             Amino acid biosynthesis_Histidine
11    B0216 0.656080300 0.398413900            Amino acid biosynthesis_Tryptophan
12    B0218 0.547111400 0.454774400              Amino acid biosynthesis_Tyrosine
13    B0219 0.130706150 0.053109630                  Amino acid biosynthesis_GABA
14    B0220 0.278230900 0.157103900          Amino acid biosynthesis_Beta-alanine
15    B0221 0.611932300 0.441615300             Amino acid biosynthesis_Ornithine
16    B0303 0.262207900 0.219991800    Amino acid derivative biosynthesis_Ectoine
17    B0307 0.331732800 0.190395900 Amino acid derivative biosynthesis_Spermidine
18    B0309 0.163550590 0.066682630 Amino acid derivative biosynthesis_Putrescine
19    B0310 0.324450620 0.096901480 Amino acid derivative biosynthesis_Tryptamine
20    B0601 0.624014300 0.519070800          Organic anion biosynthesis_Succinate
21    B0602 0.822709900 0.702780300           Organic anion biosynthesis_Fumarate
22    B0604 0.442414500 0.663182100          Organic anion biosynthesis_L-lactate
23    B0605 0.345982500 0.192877900          Organic anion biosynthesis_D-lactate
24    B0701 0.634894500 0.480184300            Vitamin biosynthesis_Thiamine (B1)
25    B0702 0.816474800 0.727775100          Vitamin biosynthesis_Riboflavin (B2)
26    B0704 0.695651400 0.423724000        Vitamin biosynthesis_Pantothenate (B5)
27    B0705 0.427025500 0.322247500         Vitamin biosynthesis_Pyridoxal-P (B6)
28    B0707 0.761055800 0.687081300    Vitamin biosynthesis_Tetrahydrofolate (B9)
29    B0708 0.529524200 0.397595900          Vitamin biosynthesis_Cobalamin (B12)
30    B0802 0.834491600 0.525997700        Aromatic compound biosynthesis_Gallate
31    B0803 0.747515200 0.466065500     Aromatic compound biosynthesis_Chorismate
32    B0804 0.713239900 0.564040300   Aromatic compound biosynthesis_Dipicolinate
33    B1029 0.020309560 0.109015400          Antibiotic biosynthesis_Pyrrolnitrin
34    D0101 0.456920700 0.195072900                Lipid degradation_Triglyceride
35    D0204 0.380570100 0.297753100             Polysaccharide degradation_Chitin
36    D0206 0.330051000 0.188121700     Polysaccharide degradation_Alpha galactan
37    D0212 0.347270600 0.568537200           Polysaccharide degradation_Arabinan
38    D0213 0.183368100 0.104352100              Polysaccharide degradation_Mucin
39    D0308 0.195833000 0.100759700                  Sugar degradation_L-Rhamnose
40    D0309 0.318345100 0.222315900                   Sugar degradation_Galactose
41    D0310 0.022423170 0.195423010                       Sugar degradation_NeuAc
42    D0501 0.621591000 0.281872700                 Amino acid degradation_Serine
43    D0505 0.406362500 0.268585000                 Amino acid degradation_Valine
44    D0506 0.413331800 0.225587800             Amino acid degradation_Isoleucine
45    D0507 0.464046400 0.327584800                Amino acid degradation_Leucine
46    D0508 0.327950100 0.201021000                 Amino acid degradation_Lysine
47    D0512 0.453178200 0.259483100              Amino acid degradation_Histidine
48    D0601 0.346266800 0.600710800         Nitrogen compound degradation_Nitrate
49    D0603 0.190956000 0.100831600           Nitrogen compound degradation_Urate
50    D0613 0.770957000 0.465556200         Nitrogen compound degradation_Taurine
51    D0704 0.599817900 0.391382100                  Alcohol degradation_Glycerol
52    D0706 0.002325978 0.005227122           Alcohol degradation_Ethylene glycol
53    D0816 0.254836100 0.147730100          Xenobiotic degradation_Phenylacetate
54    D0907 0.430336700 0.250939200           Antibiotic degradation_Tetracycline
55    D0908 0.313546400 0.169073500              Antibiotic degradation_Macrolide

9.2.2.2 Community functions differences

   Code_function        low       high                           Function
1            B02 0.60472030 0.45731280            Amino acid biosynthesis
2            B03 0.30395930 0.15951330 Amino acid derivative biosynthesis
3            B06 0.70733810 0.63489430         Organic anion biosynthesis
4            B07 0.49899850 0.41498730               Vitamin biosynthesis
5            B08 0.47988990 0.39738120     Aromatic compound biosynthesis
6            B10 0.07930675 0.11431308            Antibiotic biosynthesis
7            D01 0.49240620 0.39070900                  Lipid degradation
8            D03 0.25054260 0.17263400                  Sugar degradation
9            D05 0.37578760 0.31196260             Amino acid degradation
10           D07 0.37342050 0.27095720                Alcohol degradation
11           D09 0.17066803 0.09778859             Antibiotic degradation

9.2.2.3 Community domains differences

   Code_domain       low      high
1 Biosynthesis 0.4222222 0.3583441
2  Degradation 0.2852374 0.2242999